import service from '@/utils/request'

export const categoryList = (params?: RequestPage) => {
  return service({
    url: '/content/categories',
    method: 'get',
    params
  })
}

export const categoryCreate = (data: ContentCategory) => {
  return service({
    url: '/content/category',
    method: 'post',
    data
  })
}
export const categoryUpdate = (data: ContentCategory) => {
  return service({
    url: '/content/category',
    method: 'put',
    data
  })
}
export const categoryDelete = (id: number) => {
  return service({
    url: '/content/category/' + id,
    method: 'delete'
  })
}
export const articleCreate = (data: ContentArticle) => {
  return service({
    url: '/content/article',
    method: 'post',
    data
  })
}
export const articleUpdate = (data: ContentArticle) => {
  return service({
    url: '/content/article',
    method: 'put',
    data
  })
}
export const articleDelete = (id: number) => {
  return service({
    url: '/content/article/' + id,
    method: 'delete'
  })
}
export const articleSwitch = (data: { id: number; status: number }) => {
  return service({
    url: '/content/article/switch',
    method: 'put',
    data
  })
}
